package com.ly.datacenter.servlet;

import java.sql.Connection;

import javax.servlet.http.HttpServlet;

import com.ly.datacenter.jdbc.util.DatabaseUtil;

/**
 * function:
 * @author watson  email: watson.wu@hotmail.com
 * @date 2009-9-1
 */
public class DataSourceContainer extends HttpServlet {

	private static final long serialVersionUID = 1L;

	private static Connection connection;

	public void init() {
		String url = this.getInitParameter("url");
		String username = this.getInitParameter("username");
		String password = this.getInitParameter("password");
		System.out.println("url:"+url);
		if(connection==null) {
			connection = DatabaseUtil.createConnection(url, username, password);
		}
	}

	public static Connection getConnection() {
		return connection;
	}

}

